<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <%@ include file="/include/service-base-header.jsp" %>
    <title>login</title>
</head>

<body class="login-page ">
<div class="page-header header-filter"
     style="background-image: url(../image/background-image.jpg); background-size: cover; background-position: top center;">
    <div class="container">
        <div class="row">
            <div class="col-md-4 col-sm-6 ml-auto mr-auto">
                <div class="card card-signup">
                    <form class="form" method="" action="">
                        <div class="card-header card-header-primary text-center" style="padding: 1rem">
                            <h3 class="card-title">GO WIN</h3>
                        </div>
                        <h4 class="description text-center" style="margin-top: 2rem">管理后台</h4>
                        <div class="card-body">
                            <div class="input-group">
                                <div class="input-group-prepend">
                                        <span class="input-group-text">
                                            <i class="material-icons">face</i>
                                        </span>
                                </div>
                                <input type="text" class="form-control" placeholder="请输入管理员账号..." name="phone">
                            </div>
                            <div class="input-group">
                                <div class="input-group-prepend">
                                        <span class="input-group-text">
                                            <i class="material-icons">lock_outline</i>
                                        </span>
                                </div>
                                <input type="password" class="form-control" placeholder="请输入管理员密码..." name="password">
                            </div>
                        </div>
                        <div align="center">
                            <a onclick="login()" class="btn btn-primary btn-link btn-wd btn-lg"
                               style="margin-bottom: 0.5rem;font-size: 1rem">登 录</a>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>
</body>

<script>
    function login() {
        var phone = $(" input[ name='phone' ] ").val();
        var password = $(" input[ name='password' ] ").val();
        if (null == phone || phone == "") {
            showNotification('bottom', 'right', '账户不可为空');
            return;
        }
        if (null == password || password == "") {
            showNotification('bottom', 'right', '密码不可为空');
            return;
        }
        $.ajax({
            url: baseUrl.base + baseUrl.user + "/signBackstage",
            type: 'POST',
            data: {'accountNumber': phone, 'password': password},
            success: function (data) {
                if (data.code == "0") {
                    var res = data.results;
                    $(location).attr('href', '${pageContext.request.contextPath}/s/home.do');
                } else {
                    var res = data.msg;
                    showNotification('bottom', 'right', res);
                }
            }
        });
    }

    $(document).keypress(function (e) {
        var eCode = e.keyCode ? e.keyCode : e.which ? e.which : e.charCode;
        if (eCode == 13) {
            login();
        }
    });
</script>
</html>